﻿#region Includes

using System.Collections.Generic;
using WaveTech.GShield.Model;

#endregion

namespace WaveTech.GShield.Data.Collections
{
	/// <summary>
	/// Generic List of Game Objects
	/// </summary>
	public class GameCollection : List<Game>
	{
		#region Is Process In List

		/// <summary>
		/// Searches the collection to find the GameProcess in the
		/// collection by path.
		/// </summary>
		/// <param name="game">GameProcess object to search for</param>
		/// <returns>True if the Game is in the collection, otherwise false</returns>
		public bool IsProcessInList(GameProcess game)
		{
			bool retval = false;

			foreach (Game g in this)
			{
				if (g.Path == game.FullPath)
					retval = true; // Path to an absolute file
				else if (g.NotAGame == true && game.FullPath.Contains(g.Path))
					retval = true; // Path to a directory
			}

			return retval;
		}

		#endregion Is Process In List
	}
}